package com.google.android.material.appbar;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import com.google.android.material.appbar.AppBarLayout.Behavior;
import java.util.Arrays;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.ViewCompat;

/** 防止连续滑动时AppBarLayout发抖 */
public class AppBarLayoutBehavior2 extends Behavior
{
    public AppBarLayoutBehavior2(){
    }

    public AppBarLayoutBehavior2(Context context, AttributeSet attrs){
        super(context, attrs);
    }

    @Override
    public boolean onInterceptTouchEvent(CoordinatorLayout pa, AppBarLayout child, MotionEvent ev){
        if(ev.getAction() == MotionEvent.ACTION_DOWN){
            if(scroller != null) scroller.abortAnimation();
        }
        return super.onInterceptTouchEvent(pa, child, ev);
    }
}
